All Questions
Tagged with text-formattingscripting
22 questions
2votes
0answers
49views
Generate upper-case in a udev rule?
I have a use case with cross-platform context which makes me want to generate symlinks under a /dev/disk/by-X directory that have an uppercase version of data returned by blkid. Is there a built-in ...
1vote
3answers
89views
Writing bash arguments with trunctation
I want to print the first two arguments of a bash function, with the unicode character \u2263 on each side using a two space separation. The thing is that the final unicode must display at column 70. ...
0votes
1answer
68views
Merge multiple files and format output into columns with line wrap
I'm trying to show multiple files to a user within less. These files have relatively long lines and contain the same text but in different languages (differences in line length to be expected). ...
0votes
1answer
301views
Sed change a tag and keep part of the contents
I have a large text file with multiple occurrences of a tag containing a URL: [tag]https://example.com/222389/link/11835457224168404[/tag] I need to reformat the tags as follows: [new-tag]...
4votes
4answers
50kviews
format the shell script output as a table
I am running a script in a loop which creates some data as per some logic and then displays output in some combination but the output I am getting is in new line Roll number : 187437366 ...
0votes
0answers
286views
Indent output even for partial lines
I'm trying to indent the output of 'subcommands' in a script, like this: Turning off image... Unmounting...done. Detaching loop device...done where the indented items are individual steps ...
4votes
3answers
695views
Parsing csv file to filter rows based on a matching set of characters from a column value
Consider the following csv file: A,3300 B,8440 B,8443 B,8444 C,304 C,404 M,5502 M,5511 The actual csv file is big (around 60,000 rows). I have only included a small version to describe ...
1vote
5answers
259views
How to restructure a date variable in bash
I have a bash script that takes user-inputed dates in this format: dd.mm.yyyy and saves it as a variable $date Now I need to modify this variable to be in this format: yyyymmdd for further use. So ...
1vote
1answer
124views
Adjust columns in a table
I have this table which is messed up DB Size_in_MB foobar 11011.2 barfoo 4582.9 donkey 4220.8 shoryuken 555.9 hadouken 220.0 kong 214.8 super_mario_bros_p 211.1 there are unnecessary ...
0votes
2answers
11kviews
Display grep output in table columns
I need to display grep output in table columns. I have a script that grab info from whois to display the creation, expiry date and ns server of specific domain names. #!/bin/sh cat domain-file.txt |...
3votes
3answers
7kviews
How to left pad a column in Bash
I have a bash script that prints the following results: 120,900 1160,001 80,730 600,165 6,310 1111,203 I would like to left pad that so the result will be: 120,900 1160,001 80,730 600,165 6,...
0votes
4answers
48views
Bash - changing fileconfig format
I would like to change: THIS: client 192.168.100.1 { secret = ThisIStheSECRET shortname = HOSTNAME } client 192.168.100.2 { secret = ThisIStheSECRET2 shortname = HOSTNAME2 } THAT: ...
49votes
4answers
73kviews
Bash shell script output alignment
My script: date echo -e "${YELLOW}Network check${NC}\n\n" while read hostname do ping -c 1 "$hostname" > /dev/null 2>&1 && echo -e "Network $hostname : ${GREEN}Online${NC}" || ...
1vote
1answer
1kviews
BASH | CSV formatted report
I need to create a report of all files renamed with the ff fields in the CSV formatted report (Output.rpt).I need an output that displays a. Column1 = Original Filename b. Column2 = Original ...
7votes
4answers
14kviews
Print two files in two columns side-by-side
I want to output two text files in two columns — one on the left side and other one on the right. paste doesn't solve the problem, because it only insert a character as delimiter, so if the first file ...